import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { coreZxdaListData } from '/@/api/cardd/zxda/coreZxda';

const { t } = useI18n('cardd.zxda.coreZxda');

const modalProps = {
  title: t('专项选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 100,
  showResetButton:false,
  schemas: [
    {
      label: t('专项编码'),
      field: 'zxdaZxbm',
      component: 'Input',
    },
    {
      label: t('专项名称'),
      field: 'zxdaZxmc',
      component: 'Input',
    },
    {
      label: t('对应客户'),
      field: 'zxdaDykh',
      component: 'Input',
      ifShow:false
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('专项编码'),
    dataIndex: 'zxdaZxbm',
    key: 'a.zxda_zxbm',
    sorter: true,
    width: 120,
    align: 'left',
    slot: 'firstColumn',
  },
  {
    title: t('专项名称'),
    dataIndex: 'zxdaZxmc',
    key: 'a.zxda_zxmc',
    sorter: true,
    width: 200,
    align: 'left',
  },
  {
    title: t('立项日期'),
    dataIndex: 'zxdaLxrq',
    key: 'a.zxda_lxrq',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('对应客户'),
    dataIndex: 'basCus.khdaDwqc',
    key: 'a.zxda_dykh',
    sorter: true,
    width: 230,
    align: 'left',
  },
  {
    title: t('是否结项'),
    dataIndex: 'zxdaSfjx',
    dictType: 'sys_yes_no',
    key: 'a.zxda_sfjx',
    sorter: true,
    width: 100,
    align: 'center',
  },
  {
    title: t('结项日期'),
    dataIndex: 'zxdaJxrq',
    key: 'a.zxda_jxrq',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('备注'),
    dataIndex: 'remarks',
    key: 'a.remarks',
    sorter: true,
    width: 130,
    align: 'left',
  },
];

const tableProps: BasicTableProps = {
  api: coreZxdaListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    params['zxdaSfjx'] = '0';
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'id',
  itemName: 'zxdaZxmc',
  isShowCode: true,
};
